#include <bits/stdc++.h>
using namespace std;

const int N=2e5 + 5;
char s[N],stk[N], match[255];
bool L[255];

int main(){
  scanf("%s", s + 1);
  L['('] = L['['] = L['<'] = true;
  match[')'] = '(';
  match[']'] = '[';
  match['>'] = '<';

  int top = 0;
  for (int i = 1; s[i]; i++) {
    if (L[s[i]]) {
      stk[++top] = s[i];
    } else { // R[s[i]]
      if (top && stk[top] == match[s[i]]) {
        top--;
      } else {
        puts("No");
        return 0;
      }
    }
  }
  puts(top ? "No" : "Yes");
  return 0;
}